package com.project.bean;

import java.time.LocalDate;
import java.time.temporal.ChronoUnit;
import java.util.List;

/***
 * 项目实体类
 */
public class ProjectBean {
    /**项目id*/
    private int id;
    /**项目名称*/
    private String projectName;
    /**项目客户*/
    private String customer;
    /**项目费用*/
    private Double cost;
    /**项目开始日期*/
    private LocalDate startDate = LocalDate.now();
    /**项目交付日期*/
    private LocalDate requireDate;
    /**距离交付时间剩余天数*/
    private String remainderDay;
    /**项目状态*/
    private String status="开发中";
    /**项目参与人数*/
    private int personNum;
    /**参与项目的员工明细及参与时间*/
    private List<EmployeeDoProject> employeeDoProjectList;

    public ProjectBean() {
    }

    public ProjectBean(String projectName, String customer, Double cost, LocalDate requireDate) {
        this.projectName = projectName;
        this.customer = customer;
        this.cost = cost;
        this.requireDate = requireDate;
    }

    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getProjectName() {
        return projectName;
    }

    public void setProjectName(String projectName) {
        this.projectName = projectName;
    }

    public String getCustomer() {
        return customer;
    }

    public void setCustomer(String customer) {
        this.customer = customer;
    }

    public Double getCost() {
        return cost;
    }

    public void setCost(Double cost) {
        this.cost = cost;
    }

    public LocalDate getStartDate() {
        return startDate;
    }

    public void setStartDate(LocalDate startDate) {
        this.startDate = startDate;
    }

    public LocalDate getRequireDate() {
        return requireDate;
    }

    public void setRequireDate(LocalDate requireDate) {
        this.requireDate = requireDate;
    }

    public String getRemainderDay() {
        if(requireDate == null){
            return null;
        }
        if("交付使用".equals(this.status)){
            return "已交付";
        }
        return ChronoUnit.DAYS.between(LocalDate.now(), requireDate)+"";
    }

    public String getStatus() {
        return status;
    }

    public void setStatus(String status) {
        this.status = status;
    }

    public int getPersonNum() {
        return personNum;
    }

    public void setPersonNum(int personNum) {
        this.personNum = personNum;
    }

    public List<EmployeeDoProject> getEmployeeDoProjectList() {
        return employeeDoProjectList;
    }

    public void setEmployeeDoProjectList(List<EmployeeDoProject> employeeDoProjectList) {
        this.employeeDoProjectList = employeeDoProjectList;
    }

    @Override
    public String toString() {
        return "ProjectBean{" +
                "id=" + id +
                ", projectName='" + projectName + '\'' +
                ", customer='" + customer + '\'' +
                ", cost=" + cost +
                ", startDate=" + startDate +
                ", requireDate=" + requireDate +
                ", remainderDay='" + this.getRemainderDay() + '\'' +
                ", status='" + status + '\'' +
                ", personNum=" + personNum +
                '}';
    }
}
